package 封装;

public class Student {
    private int age;
    public int getAge(){
        return age;//可以不加this
    }
    public void setAge(int age){
        if(age>=0&&age<=150){
            this.age=age;
        }else{
            System.out.println("您输入的年龄还是人的年龄嘛？");
        }
    }
}
